package com.weirdor.wxchat.www.config;

import com.cybermkd.mongo.kit.MongoKit;
import com.cybermkd.mongo.plugin.MongoPlugin;
import com.github.sd4324530.fastweixin.api.config.ApiConfig;
import com.mongodb.MongoClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by weirdor on 2017/12/1.
 */
@Configuration
public class wwwConfig {
    @Bean(name = "apiConfig")
    public ApiConfig apiConfig() {
        ApiConfig config = new ApiConfig("wxc557cfbbb96f6182", "59d9863c9149aa0c2cc5aca946a3df17");
        return config;
    }

    @Bean
    public MongoPlugin mongoPlugin(){
        MongoPlugin mongoPlugin=new MongoPlugin();
        mongoPlugin.add("39.106.119.195",27017);
        mongoPlugin.setDatabase("wxchat");
        MongoClient client = mongoPlugin.getMongoClient();
        MongoKit.INSTANCE.init(client, mongoPlugin.getDatabase());
        return  mongoPlugin;
    }
}
